﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SchoolLibrary.Entity.Person;

namespace SchoolLibrary.Entity
{
    public class RegistryJournal : Identity
    {        
        public const string FIND_REGISTRY_JOURNAL_RECORDS = "SELECT * FROM registry_journal";
        public const string UPDATE_RETURN_DATE = "UPDATE registry_journal set return_date = CONVERT(DATE, :date, 104) where id = :id";
        public const string INSERT_REGISTRY_JOURNAL_RECORD = "INSERT INTO registry_journal (book_id, pupil_id, bail, day_amount, issue_date)" +
            " VALUES (:book_id, :pupil_id, :bail, :day_amount, CONVERT(DATE, :issue_date, 104))";

        public const string BOOK_ID_COLUMN_NAME = "book_id";
        public const string PUPIL_ID_COLUMN_NAME = "pupil_id";
        public const string BAIL_COLUMN_NAME = "bail";
        public const string ISSUE_DATE_COLUMN_NAME = "issue_date";
        public const string RETURN_DATE_COLUMN_NAME = "return_date";
        public const string DAY_AMOUNT_COLUMN_NAME = "day_amount";

        private Book book;
        private Pupil pupil;        
        private int bail;
        private int dayAmount;
        private DateTime issueDate;
        private DateTime returnDate;

        public Book Book
        {
            get { return book; }
            set { book = value; }
        }
        
        public Pupil Pupil
        {
            get { return pupil; }
            set { pupil = value; }
        }        

        public int Bail
        {
            get { return bail; }
            set { bail = value; }
        }        

        public int DayAmount
        {
            get { return dayAmount; }
            set { dayAmount = value; }
        }        

        public DateTime IssueDate
        {
            get { return issueDate; }
            set { issueDate = value; }
        }        

        public DateTime ReturnDate
        {
            get { return returnDate; }
            set { returnDate = value; }
        }

    }
}
